# file: multicore_test01.py
import machine
import _thread
import utime

led = machine.Pin(25, machine.Pin.OUT)
led.off()

key = 0
start_time = 0
def run_on_core1():
    global start_time
    while start_time == 0:
        pass

    while True:
        utime.sleep_ms(300)
        print((utime.ticks_us()-start_time)//100000, "led on")
        led.on()
        utime.sleep_ms(700)

def run_on_core0():
    global start_time
    start_time = utime.ticks_us()
    while True:
        utime.sleep_ms(700)
        print((utime.ticks_us()-start_time)//100000, "led off")
        led.off()
        utime.sleep_ms(300)

_thread.start_new_thread(run_on_core1, ( ))
run_on_core0()